package com.tank.dwr;

import java.util.ArrayList;
import java.util.List;

import org.directwebremoting.annotations.RemoteMethod;
import org.directwebremoting.annotations.RemoteProxy;
import org.springframework.beans.factory.annotation.Autowired;

import com.tank.bean.item.Image;
import com.tank.bean.product.SonType;
import com.tank.service.ImageService;
import com.tank.service.ItemsManageService;

@RemoteProxy(name="itemsDwrController")
public class ItemsDwrController {
	@Autowired
	private ImageService imageService;
	@Autowired
	private ItemsManageService itemsManageService;
	@RemoteMethod
	public List<Image> imageForPreview(String imageTag){
		List<Image> images= new ArrayList<Image>();
		images = imageService.imageForPreview(imageTag);
		return images;
	}
	@RemoteMethod
	public List<SonType> queryItemSonType(String parentId){
		List<SonType> sonTypes = new ArrayList<SonType>();
		sonTypes=itemsManageService.queryItemsSonType(Long.valueOf(parentId));
		return sonTypes;
	}
	@RemoteMethod
	public int deleteTagImage(String imageid){
		try {
			imageService.deleteTagImage(Integer.valueOf(imageid));
			return 1;
		} catch (Exception e) {
			e.printStackTrace();
			return 0;
		}
	}
	
}
